import './App.css';
import React, { PureComponent, lazy, Suspense } from 'react';
import { Route, Switch, Redirect } from 'react-router-dom'

let Index = lazy(() => import('./views/Index'))
let Login = lazy(() => import('./views/Login'))
let Register = lazy(() => import('./views/Register'))
let Register2 = lazy(() => import('./views/Register2'))
let Register3 = lazy(() => import('./views/Register3'))
let Search = lazy(() => import('./views/Search'))
let AddressList = lazy(() => import('./views/AddressList'))
let AddressAdd = lazy(() => import('./views/AddressAdd'))
let AddressUpdate = lazy(() => import('./views/AddressUpdate'))
let Good = lazy(() => import('./views/Good'))
let NotFound = lazy(() => import('./views/NotFound'))
let Orderstate =lazy(()=> import('./views/Dingdan'))
let Querendingdan =lazy(()=> import('./views/Querendingdan'))

class App extends PureComponent {
  render() {
    return (
      <div className='app'>
        <Suspense fallback={<div className='loading'><img src="http://pic.rmb.bdstatic.com/bjh/down/6fb601f1d7181a2a1b995306ba16dbef.gif"/></div>}>
          <Switch>
            <Route path="/index" component={Index} />
            <Route exact path="/login" component={Login} />
            <Route exact path="/register" component={Register} />
            <Route exact path="/register2" component={Register2} />
            <Route exact path="/register3" component={Register3} />
            <Route exact path="/search" component={Search} />
            <Route exact path="/addresslist" component={AddressList} />
            <Route exact path="/addressadd" component={AddressAdd} />
            <Route exact path="/addressupdate" component={AddressUpdate} />
            <Route exact path="/good" component={Good} />
            <Route exact path="/orderstate" component={Orderstate} />
            <Route exact path="/querendingdan" component={Querendingdan} />
            <Redirect exact from='/' to="/index" />
            <Route path="*" component={NotFound} />
          </Switch>
        </Suspense>
      </div>
    );
  }
}

export default App;